PR-1c: Compiler.run(target=) kwarg threading — InitialProg.target + KernelCtx.target#80
Merged
StarGazerM merged 1 commit intoMay 20, 2026
Conversation
Adds the target dispatch hook required by Phase B2 work without changing render behavior. `Compiler.run` accepts `target='cuda'` and exposes it on `compiler.active_target` for the duration of the call; `InitialProg` and `KernelCtx` gain a `target: str = 'cuda'` field; `VerifyRenderabilityShim` reads `state.target` instead of the hardcoded literal. Defaults preserve byte-equivalence on every existing call site. Per docs/phase_decomposition_redesign.md §2.3 (target monopolization) and §3.3.1 (target chosen at run time). Per-target render dispatch itself lands in Phase B2-2. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
4 tasks
This was referenced May 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Third of 5 splits of the original PR-1. Plumbing-only — threads
target: str = 'cuda'through the compile pipeline so Phase B2-2 (multi-target render dispatch) has the dispatch authority hook to wire to. Per spec § 2.3 + § 3.3.Compiler.run(prog, *, pipeline, target='cuda')accepts the new kwarg; restored via try/finally (exception-safe)InitialProg.target: str = 'cuda',KernelCtx.target: str = 'cuda'(both frozen dataclass field additions)VerifyRenderabilityShimreadsstate.targetinstead of hardcoded'cuda'literal'cuda'everywhere — preserves existing call-site behaviorTest plan
D10 confirmation
LowerCtx(src/srdatalog/ir/core/lower_ctx.py) already pins 5 fields includingtarget(pre-PR-1c addition). PR-1c threadstargetvia carrier dataclasses + a transientCompiler.active_targetattr — never touchesLowerCtx.Out of scope (later splits)
targets=[...])🤖 Generated with Claude Code